home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / system / mail / news / fidogate.pat < prev    next >
Encoding:
Text File  |  1994-05-17  |  25.1 KB  |  841 lines

  1. FIDOGATE 3.7 - Patch 1
  2.  
  3. Priority:
  4.  
  5.     * Medium
  6.  
  7. Bugs fixed:
  8.  
  9.     * Empty tear lines "---\n" causing illegal empty X-FTN-Tearline headers
  10.  
  11. Other changes:
  12.  
  13.     * pktdebug now writes to stdout
  14.  
  15.  
  16. Applying this patch:
  17.  
  18.     * Change to the directory containing the top level fidogate/ subdirectory
  19.     
  20.     * Enter  patch -p0 <this-patch
  21.  
  22.  
  23.  
  24. diff -uN /home/mj/tmp/fidogate-3.7/src/.depend fidogate/src/.depend
  25. --- /home/mj/tmp/fidogate-3.7/src/.depend    Mon May  2 08:45:40 1994
  26. +++ fidogate/src/.depend    Sat May  7 10:09:53 1994
  27. @@ -58,6 +58,8 @@
  28.    declare.h shuffle.h 
  29.  sequencer.o : sequencer.c fidogate.h config.h paths.h node.h packet.h sysexits.h \
  30.    declare.h 
  31. +stdoutlog.o : stdoutlog.c log.c fidogate.h config.h paths.h node.h packet.h \
  32. +  sysexits.h declare.h 
  33.  textlist.o : textlist.c fidogate.h config.h paths.h node.h packet.h sysexits.h \
  34.    declare.h 
  35.  toaddr.o : toaddr.c fidogate.h config.h paths.h node.h packet.h sysexits.h declare.h 
  36. diff -uN /home/mj/tmp/fidogate-3.7/src/ChangeLog fidogate/src/ChangeLog
  37. --- /home/mj/tmp/fidogate-3.7/src/ChangeLog    Mon May  2 08:35:57 1994
  38. +++ fidogate/src/ChangeLog    Wed May 11 00:02:14 1994
  39. @@ -1,3 +1,61 @@
  40. +Wed May 11 00:01:42 1994  Martin Junius  (mj@sungate)
  41. +
  42. +    * ----- Installed this version -----
  43. +
  44. +    * ***** Release as 3.7 patch 1 *****
  45. +
  46. +Tue May 10 23:23:55 1994  Martin Junius  (mj@sungate)
  47. +
  48. +    * RCS check in: update 3.7.1.2
  49. +
  50. +    * patchlevel.h (PATCHLEVEL): changed to 1
  51. +
  52. +    * fido2rfc.c (unpack): changed tear line code:
  53. +      - only tear lines starting with "--- " and empty tear lines
  54. +        "---\n" are recognized as possible tear lines.
  55. +      - only non-empty tear lines are written to an X-FTN-Tearline
  56. +        header.
  57. +
  58. +Sat May  7 09:53:23 1994  Martin Junius  (mj@sungate)
  59. +
  60. +    * ----- Installed this version -----
  61. +
  62. +    * RCS check in: update 3.7.1.1
  63. +
  64. +    * pktdebug.c: removed log(), debug(), now linking with stdoutlog.o.
  65. +
  66. +    * stdoutlog.c: new log()/debug(), no output to log file, write to
  67. +      stdout instead of stderr.
  68. +
  69. +    * log.c: replaced #ifdef FAKELOG with LOG_NOFILE.
  70. +      (LOG_OUTPUT): new #define replacing stderr debug output file
  71. +      (set to stdout by stdoutlog.c).
  72. +
  73. +    * pktdebug.c (log, debug): local log(), debug() to stdout.
  74. +
  75. +Fri May  6 09:18:02 1994  Martin Junius  (mj@sungate)
  76. +
  77. +    * pktdebug.c (main): use new pkt_debug_xx() functions and write to
  78. +      stdout.
  79. +      (main): added -v option.
  80. +      (usage): added -v option.
  81. +
  82. +    * packet.c (pkt_debug_hdr): new function for debug output of
  83. +      packet header.
  84. +      (pkt_get_hdr): use pkt_debug_hdr().
  85. +      (pkt_put_hdr): use pkt_debug_hdr().
  86. +
  87. +    * message.c (debug_line, msg_body_debug): additional argument out
  88. +      specifying output file, write all output to out.
  89. +
  90. +    * packet.c (pkt_debug_msg_hdr): new function for debug output of
  91. +      message header.
  92. +      (pkt_get_msg_hdr): use pkt_debug_msg_hdr().
  93. +      (pkt_put_msg_hdr): use pkt_debug_msg_hdr().
  94. +
  95. +    * Makefile (install-util): install out-attach setuid $(OWNER),
  96. +      install pktdebug, too.
  97. +
  98.  Mon May  2 07:34:41 1994  Martin Junius  (mj@sungate)
  99.  
  100.      * out-attach.c (main): accept -B, -F options.
  101. diff -uN /home/mj/tmp/fidogate-3.7/src/Makefile fidogate/src/Makefile
  102. --- /home/mj/tmp/fidogate-3.7/src/Makefile    Mon May  2 07:36:45 1994
  103. +++ fidogate/src/Makefile    Sat May  7 10:20:50 1994
  104. @@ -1,6 +1,6 @@
  105.  #:ts=8
  106.  #
  107. -#    $Id: Makefile,v 3.7 1994/05/02 05:36:42 mj Exp mj $
  108. +#    $Id: Makefile,v 3.7.1.1 1994/05/07 08:20:41 mj Exp mj $
  109.  #
  110.  #    Makefile for FIDOGATE software
  111.  #
  112. @@ -118,8 +118,8 @@
  113.      $(CC) $(LFLAGS) -o mail2news mail2news.o fakelog.o $(LIBS)
  114.  out-attach:    out-attach.o fakelog.o $(LIB)
  115.      $(CC) $(LFLAGS) -o out-attach out-attach.o fakelog.o $(LIBS)
  116. -pktdebug:    pktdebug.o fakelog.o $(LIB)
  117. -    $(CC) $(LFLAGS) -o pktdebug pktdebug.o fakelog.o $(LIBS)
  118. +pktdebug:    pktdebug.o stdoutlog.o $(LIB)
  119. +    $(CC) $(LFLAGS) -o pktdebug pktdebug.o stdoutlog.o $(LIBS)
  120.  
  121.  ffx:        ffx.o fakelog.o $(LIB)
  122.      $(CC) $(LFLAGS) -o ffx ffx.o fakelog.o $(LIBS)
  123. @@ -148,7 +148,8 @@
  124.      $(INSTALL_SETUID) ffx   $(LIBDIR)
  125.      $(INSTALL_PROG)   ffxqt $(LIBDIR)
  126.      $(INSTALL_PROG)   mail2news $(LIBDIR)
  127. -    $(INSTALL_PROG)   out-attach $(BINDIR)
  128. +    $(INSTALL_SETUID) out-attach $(BINDIR)
  129. +    $(INSTALL_PROG)   pktdebug $(BINDIR)
  130.  
  131.  install-dirs:
  132.      $(INSTALL_DIR)    $(LIBDIR)
  133. Common subdirectories: /home/mj/tmp/fidogate-3.7/src/OLD and fidogate/src/OLD
  134. Common subdirectories: /home/mj/tmp/fidogate-3.7/src/RCS and fidogate/src/RCS
  135. diff -uN /home/mj/tmp/fidogate-3.7/src/fakelog.c fidogate/src/fakelog.c
  136. --- /home/mj/tmp/fidogate-3.7/src/fakelog.c    Mon May  2 07:37:09 1994
  137. +++ fidogate/src/fakelog.c    Sat May  7 10:21:14 1994
  138. @@ -2,7 +2,7 @@
  139.  /*****************************************************************************
  140.   * FIDOGATE --- Gateway UNIX Mail/News <-> FIDO NetMail/EchoMail
  141.   *
  142. - * $Id: fakelog.c,v 3.7 1994/05/02 05:36:42 mj Exp mj $
  143. + * $Id: fakelog.c,v 3.7.1.1 1994/05/07 08:20:41 mj Exp mj $
  144.   *
  145.   * Alternate log() without writing to file
  146.   *
  147. @@ -30,6 +30,6 @@
  148.   * Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  149.   *****************************************************************************/
  150.  
  151. -#define FAKELOG
  152. +#define LOG_NOFILE
  153.  
  154.  #include "log.c"
  155. diff -uN /home/mj/tmp/fidogate-3.7/src/ffx.c fidogate/src/ffx.c
  156. --- /home/mj/tmp/fidogate-3.7/src/ffx.c    Mon May  2 08:35:58 1994
  157. +++ fidogate/src/ffx.c    Sat May  7 10:21:17 1994
  158. @@ -2,7 +2,7 @@
  159.  /*****************************************************************************
  160.   * FIDOGATE --- Gateway UNIX Mail/News <-> FIDO NetMail/EchoMail
  161.   *
  162. - * $Id: ffx.c,v 3.7 1994/05/02 05:36:42 mj Exp mj $
  163. + * $Id: ffx.c,v 3.7.1.1 1994/05/07 08:20:41 mj Exp mj $
  164.   *
  165.   * ffx FIDO-FIDO execution
  166.   *
  167. @@ -38,7 +38,7 @@
  168.  
  169.  
  170.  #define PROGRAM        "ffx"
  171. -#define VERSION        "$Revision: 3.7 $"
  172. +#define VERSION        "$Revision: 3.7.1.1 $"
  173.  
  174.  
  175.  /*
  176. diff -uN /home/mj/tmp/fidogate-3.7/src/fido2rfc.c fidogate/src/fido2rfc.c
  177. --- /home/mj/tmp/fidogate-3.7/src/fido2rfc.c    Mon May  2 07:37:19 1994
  178. +++ fidogate/src/fido2rfc.c    Tue May 10 23:59:39 1994
  179. @@ -2,7 +2,7 @@
  180.  /*****************************************************************************
  181.   * FIDOGATE --- Gateway UNIX Mail/News <-> FIDO NetMail/EchoMail
  182.   *
  183. - * $Id: fido2rfc.c,v 3.7 1994/05/02 05:36:42 mj Exp mj $
  184. + * $Id: fido2rfc.c,v 3.7.1.2 1994/05/10 21:59:17 mj Exp mj $
  185.   *
  186.   * Unpack FIDO mail packets in INBOUND directory and convert to RFC mails
  187.   * and news batches (directories INBOUND_MAIL / INBOUND_NEWS)
  188. @@ -42,7 +42,7 @@
  189.  
  190.  
  191.  #define PROGRAM "fido2rfc"
  192. -#define VERSION "$Revision: 3.7 $"
  193. +#define VERSION "$Revision: 3.7.1.2 $"
  194.  
  195.  
  196.  
  197. @@ -642,7 +642,8 @@
  198.          save_tear_line = NULL;
  199.          }
  200.          
  201. -        if(!strncmp("---", buffer, 3))    /* Possible tear line */
  202. +        if(!strncmp("--- ", buffer, 4) ||
  203. +           !strcmp("---\n", buffer)      )    /* Possible tear line */
  204.          {
  205.          save_tear_line = strsave(buffer);
  206.          continue;
  207. @@ -659,7 +660,15 @@
  208.       */
  209.      if(save_tear_line)
  210.          tear_line = save_tear_line;
  211. -    
  212. +    /*
  213. +     * Don't keep an empty tear line
  214. +     */
  215. +    if(tear_line && !strcmp(tear_line, "---\n"))
  216. +    {
  217. +        free(tear_line);
  218. +        tear_line = NULL;
  219. +    }
  220. +
  221.  
  222.      /*
  223.       * Check for mail or news.
  224. @@ -977,7 +986,7 @@
  225.  #endif
  226.  #ifdef X_FTN_TEARLINE
  227.          if(tear_line)
  228. -        Textlist_appendf(&theader, "X-FTN-Tearline:%s", tear_line+3 );
  229. +        Textlist_appendf(&theader, "X-FTN-Tearline: %s", tear_line+4 );
  230.  #endif
  231.  #ifdef X_FTN_VIA
  232.          Textlist_add(&theader, &tvia);
  233. @@ -1026,7 +1035,7 @@
  234.  #endif
  235.  #ifdef X_FTN_TEARLINE
  236.          if(tear_line)
  237. -        Textlist_appendf(&theader, "X-FTN-Tearline:%s", tear_line+3 );
  238. +        Textlist_appendf(&theader, "X-FTN-Tearline: %s", tear_line+4 );
  239.  #endif
  240.  #ifdef X_FTN_PATH
  241.          Textlist_add(&theader, &tpath);
  242. diff -uN /home/mj/tmp/fidogate-3.7/src/fidogate.h fidogate/src/fidogate.h
  243. --- /home/mj/tmp/fidogate-3.7/src/fidogate.h    Mon May  2 07:37:22 1994
  244. +++ fidogate/src/fidogate.h    Sat May  7 10:21:28 1994
  245. @@ -2,7 +2,7 @@
  246.  /*****************************************************************************
  247.   * FIDOGATE --- Gateway software UNIX <-> FIDO
  248.   *
  249. - * $Id: fidogate.h,v 3.7 1994/05/02 05:36:42 mj Exp mj $
  250. + * $Id: fidogate.h,v 3.7.1.1 1994/05/07 08:20:41 mj Exp mj $
  251.   *
  252.   * Common header file
  253.   *
  254. @@ -324,7 +324,7 @@
  255.  void    msg_body_init        P((MsgBody *));
  256.  void    msg_body_clear        P((MsgBody *));
  257.  int    msg_body_parse        P((Textlist *, MsgBody *));
  258. -void    msg_body_debug        P((MsgBody *));
  259. +void    msg_body_debug        P((FILE *, MsgBody *));
  260.  
  261.  /* misc.c */
  262.  void    stripbad        P((char *));
  263. @@ -353,6 +353,7 @@
  264.  int    pkt_get_string        P((FILE *, char *, int));
  265.  time_t    pkt_get_date        P((FILE *));
  266.  int    pkt_get_msg_hdr        P((FILE *, Message *));
  267. +void    pkt_debug_msg_hdr    P((FILE *, Message *));
  268.  int    pkt_put_string        P((FILE *, char *));
  269.  int    pkt_put_line        P((FILE *, char *));
  270.  int    pkt_put_int16        P((FILE *, int));
  271. @@ -361,6 +362,7 @@
  272.  long    pkt_get_int16        P((FILE *));
  273.  int    pkt_get_nbytes        P((FILE *, char *, int));
  274.  int     pkt_get_hdr        P((FILE *, Packet *));
  275. +void    pkt_debug_hdr        P((FILE *, Packet *));
  276.  int    pkt_put_string_padded    P((FILE *, char *, int));
  277.  int    pkt_put_hdr        P((FILE *, Packet *));
  278.  
  279. diff -uN /home/mj/tmp/fidogate-3.7/src/log.c fidogate/src/log.c
  280. --- /home/mj/tmp/fidogate-3.7/src/log.c    Mon May  2 07:37:32 1994
  281. +++ fidogate/src/log.c    Sat May  7 10:21:44 1994
  282. @@ -2,7 +2,7 @@
  283.  /*****************************************************************************
  284.   * FIDOGATE --- Gateway UNIX Mail/News <-> FIDO NetMail/EchoMail
  285.   *
  286. - * $Id: log.c,v 3.7 1994/05/02 05:36:42 mj Exp mj $
  287. + * $Id: log.c,v 3.7.1.1 1994/05/07 08:20:41 mj Exp mj $
  288.   *
  289.   * Log and debug functions
  290.   *
  291. @@ -33,6 +33,10 @@
  292.  #include "fidogate.h"
  293.  
  294.  
  295. +#ifndef LOG_OUTPUT
  296. +#define LOG_OUTPUT    stderr
  297. +#endif
  298. +
  299.  
  300.  int verbose = 0;            /* -v --verbose option */
  301.  
  302. @@ -64,7 +68,7 @@
  303.  void log(const char *fmt, ...)
  304.  {
  305.      va_list args;
  306. -#ifndef FAKELOG
  307. +#ifndef LOG_NOFILE
  308.      FILE *logfp;
  309.      char buf[MAXPATH];
  310.  #endif
  311. @@ -76,7 +80,7 @@
  312.  {
  313.      va_list args;
  314.      char *fmt;
  315. -#ifndef FAKELOG
  316. +#ifndef LOG_NOFILE
  317.      FILE *logfp;
  318.      char buf[MAXPATH];
  319.  #endif
  320. @@ -85,7 +89,7 @@
  321.      fmt = va_arg(args, char *);
  322.  #endif /**__STDC__*/
  323.  
  324. -#ifndef FAKELOG    
  325. +#ifndef LOG_NOFILE    
  326.      strncpy0(buf, cf_libdir(), sizeof(buf));
  327.      strncat0(buf, "/",         sizeof(buf));
  328.      strncat0(buf, LOG,         sizeof(buf));
  329. @@ -105,19 +109,20 @@
  330.      fclose(logfp);
  331.  
  332.      /*
  333. -     * if verbose is set, print also to stderr (without date)
  334. +     * if verbose is set, print also to LOG_OUTPUT (without date)
  335.       */
  336.      if (verbose)
  337. -#else /**FAKELOG**/
  338. +#else /**LOG_NOFILE**/
  339.      if(TRUE)
  340. -#endif /**FAKELOG**/
  341. +#endif /**LOG_NOFILE**/
  342.      {
  343. -    vfprintf(stderr, *fmt == '$' ? fmt + 1 : fmt, args);
  344. +    vfprintf(LOG_OUTPUT, *fmt == '$' ? fmt + 1 : fmt, args);
  345.      if (*fmt == '$')
  346. -        fprintf(stderr, "\n\t\terrno=%d (%s)\n", errno, strerror(errno));
  347. +        fprintf(LOG_OUTPUT, "\n\t\terrno=%d (%s)\n",
  348. +            errno, strerror(errno));
  349.      else
  350. -        fprintf(stderr, "\n");
  351. -    fflush(stderr);
  352. +        fprintf(LOG_OUTPUT, "\n");
  353. +    fflush(LOG_OUTPUT);
  354.      }
  355.  }
  356.  
  357. @@ -146,7 +151,8 @@
  358.  #endif /**__STDC__*/
  359.  
  360.      if (debug_level <= verbose) {
  361. -    vfprintf(stderr, fmt, args);
  362. -    fprintf(stderr, "\n");
  363. +    vfprintf(LOG_OUTPUT, fmt, args);
  364. +    fprintf(LOG_OUTPUT, "\n");
  365. +    fflush(LOG_OUTPUT);
  366.      }
  367.  }
  368. diff -uN /home/mj/tmp/fidogate-3.7/src/message.c fidogate/src/message.c
  369. --- /home/mj/tmp/fidogate-3.7/src/message.c    Mon May  2 07:37:37 1994
  370. +++ fidogate/src/message.c    Sat May  7 10:21:51 1994
  371. @@ -2,7 +2,7 @@
  372.  /*****************************************************************************
  373.   * FIDOGATE --- Gateway UNIX Mail/News <-> FIDO NetMail/EchoMail
  374.   *
  375. - * $Id: message.c,v 3.7 1994/05/02 05:36:42 mj Exp mj $
  376. + * $Id: message.c,v 3.7.1.1 1994/05/07 08:20:41 mj Exp mj $
  377.   *
  378.   * Reading and processing FTN text body
  379.   *
  380. @@ -35,6 +35,25 @@
  381.  
  382.  
  383.  /*
  384. + * Debug output of line
  385. + */
  386. +static void debug_line(out, line)
  387. +    FILE *out;
  388. +    char *line;
  389. +{
  390. +    int c;
  391. +    
  392. +    while( (c = *line++) )
  393. +    if( !(c & 0x60) )
  394. +        fprintf(out, "^%c", '@' + c);
  395. +    else
  396. +        putc(c, out);
  397. +    putc('\n', out);
  398. +}
  399. +
  400. +
  401. +
  402. +/*
  403.   * Read one "line" from FTN text body. A line comprises arbitrary
  404.   * characters terminated with a CR '\r'. None, one, or many LFs '\n'
  405.   * may follow:
  406. @@ -115,8 +134,8 @@
  407.          return ERROR;
  408.          if(c1 == 0)            /* Looks like it is ... */
  409.          {
  410. -        log("pkt_get_line(): grunged packet");
  411.          *p = 0;
  412. +        log("pkt_get_line(): grunged packet");
  413.          return MSG_TYPE;
  414.          }
  415.          *p++ = c;
  416. @@ -461,59 +480,43 @@
  417.  
  418.  
  419.  /*
  420. - * Debug output of line
  421. - */
  422. -static void debug_line(line)
  423. -    char *line;
  424. -{
  425. -    int c;
  426. -    
  427. -    while( (c = *line++) )
  428. -    if( !(c & 0x60) )
  429. -        fprintf(stderr, "^%c", '@' + c);
  430. -    else
  431. -        putc(c, stderr);
  432. -    putc('\n', stderr);
  433. -}
  434. -
  435. -
  436. -/*
  437.   * Debug output of message body
  438.   */
  439. -void msg_body_debug(body)
  440. +void msg_body_debug(out, body)
  441. +    FILE *out;
  442.      MsgBody *body;
  443.  {
  444.      Textline *p;
  445.      
  446. -    fprintf(stderr, "----------------------------------------"
  447. -                "--------------------------------------\n");
  448. +    fprintf(out, "----------------------------------------"
  449. +             "--------------------------------------\n");
  450.      if(body->area)
  451. -    debug_line(body->area);
  452. +    debug_line(out, body->area);
  453.      for(p=body->kludge.first; p; p=p->next)
  454. -    debug_line(p->line);
  455. -    fprintf(stderr, "----------------------------------------"
  456. +    debug_line(out, p->line);
  457. +    fprintf(out, "----------------------------------------"
  458.                  "--------------------------------------\n");
  459.      if(body->rfc.first)
  460.      {
  461.      for(p=body->rfc.first; p; p=p->next)
  462. -        debug_line(p->line);
  463. -    fprintf(stderr, "----------------------------------------"
  464. -        "--------------------------------------\n");
  465. +        debug_line(out, p->line);
  466. +    fprintf(out, "----------------------------------------"
  467. +             "--------------------------------------\n");
  468.      }
  469.      for(p=body->body.first; p; p=p->next)
  470. -    debug_line(p->line);
  471. -    fprintf(stderr, "----------------------------------------"
  472. -                "--------------------------------------\n");
  473. +    debug_line(out, p->line);
  474. +    fprintf(out, "----------------------------------------"
  475. +             "--------------------------------------\n");
  476.      if(body->tear)
  477. -    debug_line(body->tear);
  478. +    debug_line(out, body->tear);
  479.      if(body->origin)
  480. -    debug_line(body->origin);
  481. +    debug_line(out, body->origin);
  482.      for(p=body->seenby.first; p; p=p->next)
  483. -    debug_line(p->line);
  484. +    debug_line(out, p->line);
  485.      for(p=body->path.first; p; p=p->next)
  486. -    debug_line(p->line);
  487. +    debug_line(out, p->line);
  488.      for(p=body->via.first; p; p=p->next)
  489. -    debug_line(p->line);
  490. -    fprintf(stderr, "========================================"
  491. -                "======================================\n");
  492. +    debug_line(out, p->line);
  493. +    fprintf(out, "========================================"
  494. +             "======================================\n");
  495.  }
  496. diff -uN /home/mj/tmp/fidogate-3.7/src/out-attach.c fidogate/src/out-attach.c
  497. --- /home/mj/tmp/fidogate-3.7/src/out-attach.c    Mon May  2 08:35:58 1994
  498. +++ fidogate/src/out-attach.c    Sat May  7 10:21:57 1994
  499. @@ -2,7 +2,7 @@
  500.  /*****************************************************************************
  501.   * FIDOGATE --- Gateway UNIX Mail/News <-> FIDO NetMail/EchoMail
  502.   *
  503. - * $Id: out-attach.c,v 3.7 1994/05/02 05:36:42 mj Exp mj $
  504. + * $Id: out-attach.c,v 3.7.1.1 1994/05/07 08:20:41 mj Exp mj $
  505.   *
  506.   * Attach file to FLO entry in outbound
  507.   *
  508. @@ -39,7 +39,7 @@
  509.  
  510.  
  511.  #define PROGRAM        "out-attach"
  512. -#define VERSION        "$Revision: 3.7 $"
  513. +#define VERSION        "$Revision: 3.7.1.1 $"
  514.  
  515.  
  516.  
  517. diff -uN /home/mj/tmp/fidogate-3.7/src/packet.c fidogate/src/packet.c
  518. --- /home/mj/tmp/fidogate-3.7/src/packet.c    Mon May  2 07:37:49 1994
  519. +++ fidogate/src/packet.c    Sat May  7 10:21:59 1994
  520. @@ -2,7 +2,7 @@
  521.  /*****************************************************************************
  522.   * FIDOGATE --- Gateway UNIX Mail/News <-> FIDO NetMail/EchoMail
  523.   *
  524. - * $Id: packet.c,v 3.7 1994/05/02 05:36:42 mj Exp mj $
  525. + * $Id: packet.c,v 3.7.1.1 1994/05/07 08:20:41 mj Exp mj $
  526.   *
  527.   * Functions to read/write packets and messages
  528.   *
  529. @@ -102,15 +102,8 @@
  530.      pkt_get_string( fp, msg->name_from, sizeof(msg->name_from) );
  531.      pkt_get_string( fp, msg->subject  , sizeof(msg->subject  ) );
  532.  
  533. -    debug(2, "FTN message header:");
  534. -    debug(2, "    From: %-36s @ %s",
  535. -      msg->name_from, node_to_asc(&msg->node_from, TRUE));
  536. -    debug(2, "    To  : %-36s @ %s",
  537. -      msg->name_to  , node_to_asc(&msg->node_to  , TRUE));
  538. -    debug(2, "    Subj: %s", msg->subject);
  539. -    debug(2, "    Date: %s",
  540. -      msg->date!=-1 ? date(NULL, &msg->date) : "LOCAL" );
  541. -    debug(3, "    Attr: %04x", msg->attr);
  542. +    if(verbose >= 2)
  543. +    pkt_debug_msg_hdr(stderr, msg);
  544.      
  545.      return ferror(fp);
  546.  }
  547. @@ -118,6 +111,26 @@
  548.  
  549.  
  550.  /*
  551. + * Debug output of message header
  552. + */
  553. +void pkt_debug_msg_hdr(out, msg)
  554. +    FILE *out;
  555. +    Message *msg;
  556. +{
  557. +    fprintf(out, "FTN message header:\n");
  558. +    fprintf(out, "    From: %-36s @ %s\n",
  559. +        msg->name_from, node_to_asc(&msg->node_from, TRUE));
  560. +    fprintf(out, "    To  : %-36s @ %s\n",
  561. +        msg->name_to  , node_to_asc(&msg->node_to  , TRUE));
  562. +    fprintf(out, "    Subj: %s\n", msg->subject);
  563. +    fprintf(out, "    Date: %s\n",
  564. +        msg->date!=-1 ? date(NULL, &msg->date) : "LOCAL" );
  565. +    fprintf(out, "    Attr: %04x\n", msg->attr);
  566. +}
  567. +
  568. +
  569. +
  570. +/*
  571.   * Write string to packet in null-terminated format.
  572.   */
  573.  int pkt_put_string(fp, s)
  574. @@ -206,15 +219,8 @@
  575.      Message *msg;
  576.      int kludge_flag;        /* TRUE: write AREA/^AINTL,^AFMPT,^ATOPT */
  577.  {
  578. -    debug(2, "FTN message header:");
  579. -    debug(2, "    From: %-36s @ %s",
  580. -      msg->name_from, node_to_asc(&msg->node_from, TRUE));
  581. -    debug(2, "    To  : %-36s @ %s",
  582. -      msg->name_to  , node_to_asc(&msg->node_to  , TRUE));
  583. -    debug(2, "    Subj: %s", msg->subject);
  584. -    debug(2, "    Date: %s",
  585. -      msg->date!=-1 ? date(NULL, &msg->date) : "LOCAL" );
  586. -    debug(3, "    Attr: %04x", msg->attr);
  587. +    if(verbose >= 2)
  588. +    pkt_debug_msg_hdr(stderr, msg);
  589.  
  590.      /*
  591.       * Write message header
  592. @@ -318,8 +324,8 @@
  593.   * Read packet header from file
  594.   */
  595.  int pkt_get_hdr(fp, pkt)
  596. -FILE *fp;
  597. -Packet *pkt;
  598. +    FILE *fp;
  599. +    Packet *pkt;
  600.  {
  601.      long val;
  602.      struct tm t;
  603. @@ -437,15 +443,8 @@
  604.      /* Prod specific data */
  605.      if(pkt_get_nbytes(fp, xpkt, 4) == ERROR)  return ERROR;
  606.  
  607. -    debug(2, "Reading FTN packet header:");
  608. -    debug(2, "    From: %s", node_to_asc(&pkt->from, TRUE));
  609. -    debug(2, "    To  : %s", node_to_asc(&pkt->to  , TRUE));
  610. -    debug(2, "    Date: %s", date(NULL, &pkt->time));
  611. -    debug(3, "    Baud: %d", pkt->baud);
  612. -    debug(2, "    Prod: %02x %02x", pkt->product_h, pkt->product_l);
  613. -    debug(2, "    Rev : %d.%d", pkt->rev_maj, pkt->rev_min);
  614. -    debug(2, "    Pass: \"%s\"", pkt->passwd);
  615. -    debug(3, "    Capw: %04x", pkt->capword & 0xffff);
  616. +    if(verbose >= 2)
  617. +    pkt_debug_hdr(stderr, pkt);
  618.      
  619.      return ferror(fp);
  620.  }
  621. @@ -453,6 +452,26 @@
  622.  
  623.  
  624.  /*
  625. + * Debug output of packet header
  626. + */
  627. +void pkt_debug_hdr(out, pkt)
  628. +    FILE *out;
  629. +    Packet *pkt;
  630. +{
  631. +    fprintf(out, "FTN packet header:\n");
  632. +    fprintf(out, "    From: %s\n", node_to_asc(&pkt->from, TRUE));
  633. +    fprintf(out, "    To  : %s\n", node_to_asc(&pkt->to  , TRUE));
  634. +    fprintf(out, "    Date: %s\n", date(NULL, &pkt->time));
  635. +    fprintf(out, "    Baud: %d\n", pkt->baud);
  636. +    fprintf(out, "    Prod: %02x %02x\n", pkt->product_h, pkt->product_l);
  637. +    fprintf(out, "    Rev : %d.%d\n", pkt->rev_maj, pkt->rev_min);
  638. +    fprintf(out, "    Pass: \"%s\"\n", pkt->passwd);
  639. +    fprintf(out, "    Capw: %04x\n", pkt->capword & 0xffff);
  640. +}
  641. +    
  642. +
  643. +
  644. +/*
  645.   * Write string to packet, padded with 0 bytes to length n
  646.   */
  647.  int pkt_put_string_padded(fp, s, n)
  648. @@ -476,8 +495,8 @@
  649.   * (FSC-0039) header.
  650.   */
  651.  int pkt_put_hdr(fp, pkt)
  652. -FILE *fp;
  653. -Packet *pkt;
  654. +    FILE *fp;
  655. +    Packet *pkt;
  656.  {
  657.      struct tm *tm;
  658.      int swap;
  659. @@ -495,16 +514,8 @@
  660.      swap           = 0x0100;        /* Byte swapped capability word */
  661.      tm = localtime(&pkt->time);
  662.      
  663. -
  664. -    debug(2, "Writing FTN 2+ packet header:");
  665. -    debug(2, "    From: %s", node_to_asc(&pkt->from, TRUE));
  666. -    debug(2, "    To  : %s", node_to_asc(&pkt->to  , TRUE));
  667. -    debug(2, "    Date: %s", date(NULL, &pkt->time));
  668. -    debug(3, "    Baud: %d", pkt->baud);
  669. -    debug(2, "    Prod: %02x %02x", pkt->product_h, pkt->product_l);
  670. -    debug(2, "    Rev : %d.%d", pkt->rev_maj, pkt->rev_min);
  671. -    debug(2, "    Pass: \"%s\"", pkt->passwd);
  672. -    debug(3, "    Capw: %04x", pkt->capword & 0xffff);
  673. +    if(verbose >= 2)
  674. +    pkt_debug_hdr(stderr, pkt);
  675.  
  676.      /*
  677.       * Write the actual header
  678. diff -uN /home/mj/tmp/fidogate-3.7/src/patchlevel.h fidogate/src/patchlevel.h
  679. --- /home/mj/tmp/fidogate-3.7/src/patchlevel.h    Mon May  2 07:37:55 1994
  680. +++ fidogate/src/patchlevel.h    Wed May 11 00:00:11 1994
  681. @@ -2,9 +2,9 @@
  682.  /*****************************************************************************
  683.   * FIDOGATE --- Gateway software UNIX Mail/News <-> FIDO NetMail/EchoMail
  684.   *
  685. - * $Id: patchlevel.h,v 3.7 1994/05/02 05:36:42 mj Exp mj $
  686. + * $Id: patchlevel.h,v 3.7.1.2 1994/05/10 21:59:17 mj Exp mj $
  687.   *
  688.   * Global patch level
  689.   *****************************************************************************/
  690.  
  691. -#define PATCHLEVEL    0
  692. +#define PATCHLEVEL    1
  693. diff -uN /home/mj/tmp/fidogate-3.7/src/pktdebug.c fidogate/src/pktdebug.c
  694. --- /home/mj/tmp/fidogate-3.7/src/pktdebug.c    Thu Apr 28 00:30:04 1994
  695. +++ fidogate/src/pktdebug.c    Sat May  7 11:06:24 1994
  696. @@ -2,7 +2,7 @@
  697.  /*****************************************************************************
  698.   * FIDOGATE --- Gateway UNIX Mail/News <-> FIDO NetMail/EchoMail
  699.   *
  700. - * $Id$
  701. + * $Id: pktdebug.c,v 3.7 1994/05/07 09:06:22 mj Exp mj $
  702.   *
  703.   * Debug contents of FTN packet
  704.   *
  705. @@ -37,7 +37,7 @@
  706.  
  707.  
  708.  #define PROGRAM        "pktdebug"
  709. -#define VERSION        "$Revision: 0.0 $"
  710. +#define VERSION        "$Revision: 3.7 $"
  711.  
  712.  
  713.  
  714. @@ -62,6 +62,7 @@
  715.  options:  -m --msg-header              print message header\n\
  716.            -t --msg-text                print message text\n\
  717.  \n\
  718. +          -v --verbose                 more verbose\n\
  719.        -h --help                    this help\n");
  720.  
  721.      exit(0);
  722. @@ -72,8 +73,8 @@
  723.  /***** main() ****************************************************************/
  724.  
  725.  int main(argc, argv)
  726. -int argc;
  727. -char *argv[];
  728. +    int argc;
  729. +    char *argv[];
  730.  {
  731.      FILE *fp;
  732.      Packet pkt;
  733. @@ -90,6 +91,7 @@
  734.      {
  735.      { "msg-header",   0, 0, 'm'},
  736.      { "msg-text",     0, 0, 't'},        
  737. +    { "verbose",      0, 0, 'v'},    /* More verbose */
  738.      { "help",         0, 0, 'h'},    /* Help */
  739.      { 0,              0, 0, 0  }
  740.      };
  741. @@ -97,7 +99,7 @@
  742.      Textlist_init(&tl);
  743.      msg_body_init(&body);
  744.      
  745. -    while ((c = getopt_long(argc, argv, "mth",
  746. +    while ((c = getopt_long(argc, argv, "mtvh",
  747.                  long_options, &option_index     )) != EOF)
  748.      switch (c) {
  749.      case 'm':
  750. @@ -108,6 +110,9 @@
  751.          break;
  752.          
  753.      /***** Common options *****/
  754. +    case 'v':
  755. +        verbose++;
  756. +        break;
  757.      case 'h':
  758.          usage();
  759.          break;
  760. @@ -129,28 +134,31 @@
  761.  
  762.      fp = xfopen(name, R_MODE);
  763.  
  764. -    verbose = 5;
  765. -    pkt_get_hdr(fp, &pkt);
  766. -    verbose = 0;
  767. +    if(t_flag)
  768. +        fprintf(stdout, "========================================"
  769. +                        "======================================\n");
  770.  
  771. +    pkt_get_hdr(fp, &pkt);
  772. +    pkt_debug_hdr(stdout, &pkt);
  773. +    
  774.      if(t_flag)
  775. -        fprintf(stderr, "========================================"
  776. +        fprintf(stdout, "========================================"
  777.                          "======================================\n");
  778.  
  779.      type = pkt_get_int16(fp);
  780.      while(type == MSG_TYPE)
  781.      {
  782. -        if(m_flag)
  783. -        verbose = 5;
  784.          msg.node_from = pkt.from;
  785.          msg.node_to   = pkt.to;
  786.          pkt_get_msg_hdr(fp, &msg);
  787. -        verbose = 0;
  788. +        if(m_flag)
  789. +        pkt_debug_msg_hdr(stdout, &msg);
  790. +        
  791.          type = pkt_get_body(fp, &tl);
  792.          if( (err = msg_body_parse(&tl, &body)) != OK)
  793. -        fprintf(stderr, "ERROR PARSING MESSAGE BODY (%d) !!!\n", err);
  794. +        fprintf(stdout, "ERROR PARSING MESSAGE BODY (%d) !!!\n", err);
  795.          if(t_flag)
  796. -        msg_body_debug(&body);
  797. +        msg_body_debug(stdout, &body);
  798.      }
  799.      }
  800.      
  801. diff -uN /home/mj/tmp/fidogate-3.7/src/stdoutlog.c fidogate/src/stdoutlog.c
  802. --- /home/mj/tmp/fidogate-3.7/src/stdoutlog.c    Thu Jan  1 01:00:00 1970
  803. +++ fidogate/src/stdoutlog.c    Sat May  7 10:06:56 1994
  804. @@ -0,0 +1,36 @@
  805. +/*:ts=8*/
  806. +/*****************************************************************************
  807. + * FIDOGATE --- Gateway UNIX Mail/News <-> FIDO NetMail/EchoMail
  808. + *
  809. + * $Id: stdoutlog.c,v 3.7 1994/05/07 08:06:54 mj Exp mj $
  810. + *
  811. + * Alternate log() without writing to file, but writing to stdout
  812. + *
  813. + *****************************************************************************
  814. + * Copyright (C) 1990, 1993
  815. + *  _____ _____
  816. + * |     |___  |   Martin Junius             FIDO:      2:242/6.1
  817. + * | | | |   | |   Republikplatz 3           Internet:  mj@sungate.fido.de
  818. + * |_|_|_|@home|   D-52072 Aachen, Germany   Phone:     ++49-241-86931 (voice)
  819. + *
  820. + * This file is part of FIDOGATE.
  821. + *
  822. + * FIDOGATE is free software; you can redistribute it and/or modify it
  823. + * under the terms of the GNU General Public License as published by the
  824. + * Free Software Foundation; either version 2, or (at your option) any
  825. + * later version.
  826. + *
  827. + * FIDOGATE is distributed in the hope that it will be useful, but
  828. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  829. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  830. + * General Public License for more details.
  831. + * 
  832. + * You should have received a copy of the GNU General Public License
  833. + * along with FIDOGATE; see the file COPYING.  If not, write to the Free
  834. + * Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  835. + *****************************************************************************/
  836. +
  837. +#define LOG_NOFILE
  838. +#define LOG_OUTPUT    stdout
  839. +
  840. +#include "log.c"
  841.